<template>
  <div>
    <el-input
      v-model="info.userId"
      placeholder="请输入内容"
      v-if="false"
    ></el-input>
    <el-input v-model="info.userName" placeholder="请输入内容"></el-input>
    <el-input v-model="info.userPassword" placeholder="请输入内容"></el-input>
    <el-input
      v-model="info.userSurnameName"
      placeholder="请输入内容"
    ></el-input>
    <el-input v-model="info.userPhone" placeholder="请输入内容"></el-input>
    <el-button type="primary" @click="submit()">提交修改</el-button>
  </div>
</template>

<script>
export default {
  name: "UpdateUser",
  beforeRouteEnter(to, from, next) {
    next((vm) => {
      vm.postOneUserData();
    });
  },
  data() {
    return {
      info: {
        userId: "",
        userName: "",
        userPassword: "",
        userSurnameName: "",
        userPhone: "",
      },
    };
  },
  methods: {
    postOneUserData() {
      this.axios({
        Headers: {
          Authorization: window.sessionStorage.getItem("userLogin"),
        },
        method: "get",
        url: this.$constant.url + "/user/queryOneAdminUser",
      }).then((response) => {
        this.info = response.data;
        console.log(info);
      });
    },
    updataOneUser() {
      this.axios({
        method: "post",
        headers: {
          Authorization: window.sessionStorage.getItem("userLogin"),
        },
        url: this.$constant.url + "/user/updateOneUser",
        data: {
          username: this.username,
          userpassword: this.userpassword,
          userusersurnamename: this.userusersurnamename,
          userphone: this.userphone,
        },
      }).then(({ data }) => {});
    },
  },
};
</script>

<style scoped>
</style>